import { ajax } from '@/utils'

import { AddRule, RuleListRes } from './activityRuleTypes'

export default {
  /** 获取规则列表 */
  getRuleList(data): Promise<RuleListRes> {
    return ajax.post('/yswy-zy-activity/activityRuleManage/list', data)
  },
  //**新增规则 */
  createRule(data: AddRule): Promise<any> {
    return ajax.post('/yswy-zy-activity/activityRuleManage/create', data)
  },
  /** 编辑规则 */
  editRule(data): Promise<any> {
    return ajax.post('/yswy-zy-activity/activityRuleManage/edit', data)
  },
  /** 获取规则详情 */
  getRuleDetail(id: number): Promise<any> {
    return ajax.get(`/yswy-zy-activity/activityRuleManage/detail/${id}`)
  },
  /** 规则删除 */
  deleteRule(id: number): Promise<any> {
    return ajax.get(`/yswy-zy-activity/activityRuleManage/delete/${id}`)
  }
}
